package com.bawei.main

import com.blankj.utilcode.util.LogUtils
import com.tencent.smtt.export.external.interfaces.ConsoleMessage
import com.tencent.smtt.export.external.interfaces.JsPromptResult
import com.tencent.smtt.export.external.interfaces.JsResult
import com.tencent.smtt.sdk.WebChromeClient
import com.tencent.smtt.sdk.WebView

/**
 * Author: Jason Zhang
 * Date: 2024/12/18
 * Desc: 控制页面中用户所有交互
 */
class X5WebViewChromeClient: WebChromeClient() {

    override fun onJsAlert(p0: WebView?, p1: String?, p2: String?, p3: JsResult?): Boolean {
        return true
    }

    override fun onJsConfirm(p0: WebView?, p1: String?, p2: String?, p3: JsResult?): Boolean {
        return true
    }

    override fun onJsPrompt(p0: WebView?, p1: String?, p2: String?, p3: String?, p4: JsPromptResult?): Boolean {
        return true
    }

    override fun onJsBeforeUnload(p0: WebView?, p1: String?, p2: String?, p3: JsResult?): Boolean {
        return true
    }

    override fun onConsoleMessage(msg: ConsoleMessage?): Boolean {
        LogUtils.i("X5WebView: ${msg?.message()}")
        return true
    }




}